# from watermarking.dct_watermark import DCT_Watermark
# import torchvision.datasets as datasets
# import numpy as np
# from PIL import Image
# import hashlib
# import qrcode
# import cv2
# import imagehash


# # https://aistudio.baidu.com/datasetdetail/182091
# # Imagenet-100 数据集介绍
# imraw_file = "/mnt/e/datasets/ImageNet-100/train/n01877812/ILSVRC2012_val_00000655.JPEG"

# imwmd_file = "/mnt/e/pydev/hash-store/watermarking/images/watermarked.jpg"
# sig_file = "/mnt/e/pydev/hash-store/watermarking/images/signature.jpg"

# with open(
#     imraw_file,
#     mode="rb",
# ) as pic:
#     img = cv2.imread(imraw_file)
#     # Get Qrcode information
#     hashfunc = hashlib.sha256()
#     hashfunc.update(pic.read())
#     hashv = hashfunc.hexdigest()
#     qr = qrcode.QRCode(version=1)
#     qr.add_data(hashv)
#     # Generate image watermark
#     wm = qr.make_image(fill_color="black", back_color="white")
#     wm = np.array(wm.getdata()).reshape(wm.size).astype(np.float32)
#     dct = DCT_Watermark()
#     # Generate watermarked image
#     wmd = dct.embed(img, wm)
#     cv2.imwrite(imwmd_file, wmd)
#     # Extract watermark from watermarked image
#     wmd = cv2.imread(imwmd_file)
#     dct = DCT_Watermark()
#     signature = dct.extract(img)
#     cv2.imwrite(sig_file, signature)

#     imraw = Image.open(imraw_file)
#     phash_raw = imagehash.phash(imraw)
#     print(phash_raw)

#     imraw = Image.open(imwmd_file)
#     phash_raw = imagehash.phash(imraw)
#     print(phash_raw)
